package
{
	import flash.events.TimerEvent;
	import flash.utils.Timer;

	public class Control
	{
		private var _model:Model;
		private var hour:String;
		private var minute:String;
		private var second:String;
		private var timer:Timer = new Timer(1000);
		
		public function Control(model:Model)
		{
			_model = model;
		}
		
		public function starUp():void
		{
			timer.start();
			timer.addEventListener(TimerEvent.TIMER, onTimer);
		}
		
		private function onTimer(e:TimerEvent):void
		{
			var date:Date = new Date();
			_model.hour = date.getHours()<9?"0" + date.getHours():String(date.getHours());
			_model.minute = date.getMinutes()<9?"0" + date.getMinutes():String(date.getMinutes());
			_model.second = date.getSeconds()<9?"0" + date.getSeconds():String(date.getSeconds());
		}
	}
}